package j01collections;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class J1 {
    public static void main(String[] args) {
        ArrayList<Integer> arr1 = new ArrayList<>();
        Collections.addAll(arr1,2,4,6,1,6,5,7);
        System.out.println("arr1 = " + arr1);

//        Collections.sort(arr1, new Comparator<Integer>() {
//            @Override
//            public int compare(Integer o1, Integer o2) {
//                return o2-o1;
//            }
//        });
        Collections.sort(arr1, (o1,o2)->o2-o1);
        System.out.println("arr1 = " + arr1);
        System.out.println(Collections.max(arr1));//7
    }
}
